<!--
 * Copyright 2013 The Chromium Authors. All rights reserved.  Use of this
 * source code is governed by a BSD-style license that can be found in the
 * LICENSE file.
-->
<html>
  <head>
    <script type="text/javascript">

      // The window reference of the embedder to send post message reply.
      var embedderWindowChannel = null;

      var notifyEmbedder = function(msg_array) {
        embedderWindowChannel.postMessage(JSON.stringify(msg_array), '*');
      };

      var onPostMessageReceived = function(e) {
        embedderWindowChannel = e.source;
        var data = JSON.parse(e.data);
        if (data[0] == 'get-frame-name') {
          var testName = data[1];
          notifyEmbedder(['get-frame-name', testName, window.name]);
        } else if (data[0] == 'close') {
          window.close();
        }
      };

      window.addEventListener('message', onPostMessageReceived, false);
    </script>
  </head>
  <body>
    <div>This is a guest in a new webview.</div>
  </body>
</html>
